package com.wxy;

public class Student implements Comparable<Student>{
    private String name;
    private int age;

    public Student(String name, int age) {
        this.name = name;
        this.age = age;

    }

    public Student() {

    }

    public void setName(String name) {
        this.name = name;
    }

    public String getName() {
        return name;
    }

    public void setAge(int age) {
        this.age = age;
    }

    public int getAge() {
        return age;
    }
    @Override
    public int compareTo(Student o) {
        //按照学生的年龄的年龄正序排序
        //按照学生的年龄的年龄倒序排序（o对象的年龄减去this对象的年龄）
        return o.getAge() - this.getAge();
        //return this.getAge() - o.getAge();

    }
}
